<template>
  <div class="member-order-page">
    <XtxTabs v-model="activeName" @tab-click="tabClick">
      <XtxTabsPanel
        v-for="item in orderStatus"
        :key="item.name"
        :label="item.label"
        :name="item.name"
        >{{item.label}}</XtxTabsPanel>
    </XtxTabs>
  </div>
  <div v-if="orderList" class="order-list">
      <OrderItem v-for="item in orderList" :key="item.id" :order="item" />
  </div>
  <div v-else class="loading"></div>
</template>
<script>
import { ref } from 'vue'
import { orderStatus } from '@/api/constants'
import OrderItem from './components/order-item'
export default {
  name: 'MemberOrder',
  components: { OrderItem },
  setup () {
    const activeName = ref('all')

    const tabClick = (tab) => {
      // 此时：tab.index 就是订单的状态
      requestParams.orderState = tab.index
      requestParams.page = 1
    }

    return { activeName, orderStatus }
  }
}
</script>
<style scoped lang="less">
.order-list {
  padding: 20px;
}
</style>
